package day2.cases.traittest

/**
  * Created by Administrator on 2017/6/8.
  */
trait Logged {
  def log(msg:String){}
}
trait AMyLogger extends Logged{
  override def log(msg:String): Unit ={
    println("test:"+msg)
  }
}
trait BMyLogger extends Logged{
  override def log(msg:String): Unit ={
    println("log:"+msg)
  }
}
class Person3(val name:String) extends AMyLogger{
  def sayHello(): Unit ={
    println("Hi ,i'm name")
    log("sayHello is invoked!")
  }
}



object  test5{
  def main(args: Array[String]): Unit = {
    val p3=new Person3("zhangxueyou")
    val p2=new Person3("zhangxueyou")  with BMyLogger
    p2.sayHello()
//    val p1=new Person3("liudehua") with  BMyLogger
//    p1.sayHello()

  }
}